﻿@model DLM.Web.ViewModel.InvitationPageView
@using Webdiyer.WebControls.Mvc;
@{
    ViewBag.Title = "活动邀请";
    Layout = "~/Views/Shared/_Master.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">

    $(function () {
        $(":checkbox").attr("checked", false);
        /**全选与反选**/
        $("#checkAll").click(function () {
            /**方法1**/
            if ($("#checkAll").attr("checked")) {
                $(":checkbox").attr("checked", true);
            } else {
                $(":checkbox").attr("checked", false);
            }
        });
    });

    $(document).ready(function () {
        $("ul.clearfix li").mouseover(function () {

            $(this).addClass("hover");
        });
        $("ul.clearfix li").mouseout(function () {

            $(this).removeClass("hover");
        });
        $("a").css("cursor", "pointer");
    });

    function onGreetSuccessed() {
        ShowDialogMessage('right', "您的邀请成功发送！");
    }


    function onGreetFalied(ajaxContext) {
        ShowDialogMessage("warn", ajaxContext.responseText);
    }
</script>
<div class="main">
    <div class="main_tab_2">
        <div class="main_tab_2_up">
            <ul>
                <li class="current"><a href="#">站内好友</a></li>
                <li><a href="#">站外好友</a></li>
            </ul>
        </div>
        <div class="main_tab_2_down">
            <div class="box">
                <h3>
                    邀请好友<a href="#" class=""></a></h3>
                @using (Html.BeginForm("BatchInvitation", "Party", new { partyID = Model.PartyID }, FormMethod.Post))
                {
                    
           
                    <div class="tr clearfix">
                        <div class="friend_list">
                            <ul class="clearfix">
                                @if (Model != null)
                                {
                                    foreach (var item in Model.Friends)
                                    {
                                       
                                    <li><a href="#">
                                             @if (item.FriednPhoto == "none_75_75.png")
                                        {
                                          <img src="@Url.Content("~/Content/ad/none_75_75.png")" />
                                        }
                                        else
                                        { 
                                          <img src="@Url.Content("~/Files/Photos/" + item.MyFriendID + "/Title/" + item.FriednPhoto)" />
                                        }
                                       </a>
                                        <p>
                                            <input type="checkbox" id="checkedId" name="checkedId" value="@item.MyFriendID" class="checkbox" />
                                            @*@Html.CheckBox(item.UserID.ToString(), false, new { @class = "checkbox" })*@ @*  @Html.Hidden(item.AccountName,item.UserID)*@
                                            <a href="#">@item.FriendAccount</a></p>
                                        <span><a href="@Url.Action("View", "User", new { id=item.MyFriendID})">查看资料</a>| @Ajax.ActionLink("邀请", "Invitation", new { userID = item.MyFriendID, partyID = Model.PartyID }, new AjaxOptions { HttpMethod = "Post", OnSuccess = "onGreetSuccessed", OnFailure = "onGreetFalied" })</span>
                                    </li>
                                    }
                                }
                            </ul>
                            @Ajax.Pager(Model.Friends as PagedList<DLM.Domain.Model.User>, new PagerOptions
                        {
                            PageIndexParameterName = "publishid",
                            CurrentPagerItemWrapperFormatString = "<span class=\"current\">{0}</span>",
                            NumericPagerItemWrapperFormatString = "<a>{0}</a>",
                            PrevPageText = "<",
                            NextPageText = ">",
                            ShowNumericPagerItems = true,
                            ShowFirstLast = false,
                            ShowPrevNext = true,
                            CssClass = "scott",
                            MorePageText = "...",
                            SeparatorHtml = ""
                        }, new AjaxOptions { UpdateTargetId = "divPublish" })
                        </div>
                    </div>
                    <h3>
                    </h3>
                    <div class="tr clearfix btn">
                        <div class="info">
                            @if (Model != null)
                            {
                                <input type="submit" value="" class="invit" />
                            }
                        </div>
                    </div>
                }
            </div>
            <div class="box" style="display: none;">
                <h3>
                    发出邀请<a href="#"></a></h3>
                @using (Html.BeginForm("EmailInvitate", "Party", new { partyID=Model.PartyID}, FormMethod.Post))
                {
                    <div class="tr clearfix">
                        <label class="lb">
                            <s></s>姓名</label>
                        <div class="info">
                            @Html.TextBoxFor(m => m.EmailInvitation.AccountName, new { @class = "text" })
                            <div class="va">
                                为了方便活动联系，请使用真实姓名</div>
                        </div>
                    </div>
                    <div class="tr clearfix">
                        <label class="lb">
                            <s></s>邮箱地址</label>
                        <div class="info">
                            @Html.TextBoxFor(m => m.EmailInvitation.Email, new { @class = "text t_3" })
                            <div class="va">
                            </div>
                        </div>
                    </div>
@*                <div class="tr clearfix">
                    <label class="lb">
                        <s></s>标题</label>
                    <div class="info">
                        <input type="text" class="text t_3" />
                        <div class="va">
                        </div>
                    </div>
                </div>
                <div class="tr clearfix">
                    <label class="lb">
                        <s></s>内容</label>
                    <div class="info">
                        <textarea class="textarea"></textarea>
                        <div class="va">
                        </div>
                    </div>
                </div>*@
                    <div class="tr clearfix btn">
                        <label class="lb">
                            <s></s>&nbsp;</label>
                        <div class="info">
                            <input type="submit" value="" class="invit" />
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>
</div>
